package day13.tarena.com;

public class Student {
		private int id;
		private String name;
		
		public Student(int id, String name) {
			super();
			this.id = id;
			this.name = name;
		}

		public int getId() {
			return id;
		}
		public void setId(int id) {
			this.id = id;
		}
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		
		@Override
		public boolean equals(Object obj){
				if(obj == null) return false;
				else if(obj instanceof Student){
						Student s = (Student)obj;
						System.out.println(this.id+","+s.id);
						return s.id == this.id;
						//return name.equals(s.name);
				}return false;
		}
		@Override
		public int hashCode(){
				System.out.println("call hashCode"+id);
				int type = 31;
				return type*41 + id;
				//return type*41 + name.hashCode();
		}
		@Override
		public String toString(){
				return id+":"+name;
		}
		
}
